can develop on the cloud, you can run and deploy Go/revel applications on the same machine without having to configure a server * *. Now, let's use Go and Revel to develop a task list application on the Paizacloud IDE. Follow the instructions below, * * You'll be able to create and run the Google Home app in just 10 minutes * *. # # Start: [Paizacloud Cloud IDE]
corresponding path. Then execute again:Go Build Github.com/revel/revelCompilation succeeded
Second, install Revel Command line toolDownload the Revel Command line tool source code, put its source into the%gopath%src/github.com/revel/cmd directory, and then in the%GOPATH%SRC directory to compile operations:Compiling: G
. After the installation is complete, the following prompt appears when you run the Revel command:Localhost:golang user$ revel~~ revel! Http://revel.github.io~usage:revel command [arguments]the commands is: new Create a skeleton revel Application Run run a Rev
. After the installation is complete, the following prompt appears when you run the Revel command:Localhost:golang user$ revel~~ revel! Http://revel.github.io~usage:revel command [arguments]the commands is: new Create a skeleton revel Application Run run a Rev
file is then generated in the Bin directory. The installation of Revel here is complete.
After the installation is complete, the following prompt appears when you run the Revel command:
Localhost:golang user$ revel~~ revel! Http://revel.github.io~usage:revel command [arguments]the commands is: new Create a
go, all programs need to be compiled before they can be run. This also means that compiling a good application directly becomes an executable file that, at run time, does not depend on any runtime. Therefore, the deployment of Revel applications is also broadly divided into two ways:
Compiling a publication locally
Running on server-side compilationEach has its own advantages, the deployment of a slightly different way, you can choose according to
This is a creation in
Article, where the information may have evolved or changed.
Sorry, ladies and gentlemen, before starting this chapter, please come first, the 5th chapter of the whole project CSS copy out, this chapter forgot to add, originally wanted to add in the back, but found that the content of the page too much
1. Design Review pageThe previous chapter we did a simple blog and display function, here have to say, first of all, our blog can not add image links such things, do not supp
This is a creation in
Article, where the information may have evolved or changed.
This article for a detailed look at the Revel command-line tool. Here are a few files for this package, along with the corresponding feature descriptions.
Filename
Brief description (short)
Full Description (Long)
Clean.go
Clean a Revel application ' s temp files
The
This is a creation in
Article, where the information may have evolved or changed.
Demo Address http://gblog-revel.herokuapp.com/
1. Implement Message BoardWe did a simple design in the previous chapter, pick on the message form has, then .....
First, create a new message.go content under App/models:
Package Modelsimport ("Github.com/revel/revel" "Labix.org/v2/
This is a creation in
Article, where the information may have evolved or changed.
Use advanced technology to build a go web development environment1. Installing the Go language does not introduce too much here, just execute the following command
Brew Install Go
2. Configure Gopath to add the following configuration in/etc/profile
export gopath= "/USR/LOCAL/CELLAR/GO/1.5.1/" Export path= "/usr/local/cellar/go/1.5.1/bin: $PATH"
Where the/USR/LOCAL/CELLAR/GO/1.5.1/directory is the loc
command-line toolsBecause the domestic Google by the wall, the installation will report the following questions:Hint missing go websocket package, here to download manually:Http://code.google.com/p/go/source/browse/?repo=netDownload the zip version of the extract directly (the path must be correct):Then execute the following command in the cmd window:To see if it was successful:Instructions to install successfully!Next, try creating a new Web App:Run the MyApp application:This shipment starts a
, download the dependency package
Go get Golang.org/x/tools/cmd/vet
Go get Golang.org/x/tools/cmd/godoc
Go get Github.com/nsf/gocode
Go get github.com/jstemmer/gotags
#MongoDB Client
Go get gopkg.in/mgo.v2
#Mysql Client
Go get Github.com/go-sql-driver/mysql
#Redis Client
Go get Github.com/garyburd/redigo/redis
2.3. Configure Revel Environment
Go get Github.com/revel/r
// Install Revel Framework $ go get github.com/revel/cmd/revel // Installing Revel cmd command-line tools
Because the domestic Google by the wall, the installation will report the following questions:
Hint missing go websocket package, here to download manually:
Http://code.google.com/p/go/source/browse/?repo
This is a creation in
Article, where the information may have evolved or changed.
First download Revel
go get -u github.com/revel/cmd/revel
Create an App
#假设GOPATH = /GOPATHcd /GOPATHrevel new coding.net/revel-example
The above command creates an
1.app/controllers/app.go ControllerPackage Controllersimport"Github.com/revel/revel"type Appstruct { *Revel. Controller}func (c App) Index () Revel. Result {str:="pass a variable to the template to see" returnC.render (str)}
This is a creation in
Article, where the information may have evolved or changed.
Revel is a typical MVC framework that uses the command Revel new [appname] to create a Revel project with the default structure:
App
| CONTROLLERS-MVC mode controller, receiving client request to complete the logical processing and retu
) createallhistory () {DAO. RemoveAll (); var end int = time. Now (). Year (); for i:=baseyear;i
This model has only two properties, but only the year attribute saved to the DB, look at the last method, we judge the difference between the current and the baseyear based on Baseyear, and then do the archive.
Well, in Controllers/app.go's history method, make the following changes:
Func (c App) history () Revel
) createallhistory () {DAO. RemoveAll (); var end int = time. Now (). Year (); for i:=baseyear;i
This model has only two properties, but only the year attribute saved to the DB, look at the last method, we judge the difference between the current and the baseyear based on Baseyear, and then do the archive.
Well, in Controllers/app.go's history method, make the following changes:
Func (c App) history () Revel
HG
Go get clones rely on Git and Mercurial
· Installing Git
· Installing Mercurial
Reference:http://www.cnblogs.com/ghj1976/archive/2013/03/08/2949237.html
Iv. access to the Revel framework
Go get Github.com/robfig/revel
If Gopathis not set, it will be downloaded to the goroot directory or downloaded to the first directory in Gopath .
Reference:http://www.cnblogs.com/ghj1976/archive/2013/03/08/294923
This is a creation in
Article, where the information may have evolved or changed.
Demo Address http://gblog-revel.herokuapp.com/
1. Design the email Wall pageAh, what is the email wall ah, this, Bo Master, casually pull something, do not know to everyone West like, first to do, look at the effect behind it.
First create the emails.html content under Views/app:
{{set.} "title" "Email List-gblog"}}{{set. "EMA" "Active"}}{{template "header.html".}} A
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.